//
//  BangDanViewController.m
//  喜马拉雅FM
//
//  Created by dllo on 16/3/2.
//  Copyright © 2016年 lanou.com. All rights reserved.
//

#import "BangDanViewController.h"
#import "CellForTypeOfDetail.h"

#import "ModelForTypeOfListOfDetail.h"

#import "SecendViewController.h"
#import "ModelForBangDan.h"
#import "ModelForListen.h"

@interface BangDanViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableView;

@end

@implementation BangDanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createTableView];
}

- (void)createTableView {

    self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    [self.tableView release];
    
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    
    [self.tableView registerClass:[CellForTypeOfDetail class] forCellReuseIdentifier:@"poolForCellTypeOfDetail"];
}

#pragma mark tableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.arrForBanDan.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    ModelForListen *model = [self.arrForBanDan objectAtIndex:indexPath.row];
    CellForTypeOfDetail *cell = [tableView dequeueReusableCellWithIdentifier:@"poolForCellTypeOfDetail"];
    [cell passModelForBangDan:model];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    ModelForListen *model = [self.arrForBanDan objectAtIndex:indexPath.row];
    SecendViewController *secend = [[SecendViewController alloc]init];
    secend.stringForAlbumID = model.albumId;
    secend.modelForListen = model;
    [self.navigationController pushViewController:secend animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}


@end
